<template>
  <el-dialog
      v-model="storeDetailVisible"
      title="查看仓库"
      width="50%"
  >
    <template #default>
      <el-descriptions >
        <el-descriptions-item label="仓库编码">{{store.storeCode}}</el-descriptions-item>
        <el-descriptions-item label="仓库名称">{{store.storeName}}</el-descriptions-item>
        <el-descriptions-item label="位置">{{store.storePosition}}</el-descriptions-item>
        <el-descriptions-item label="面积">{{store.storeAreas}}</el-descriptions-item>
        <el-descriptions-item label="负责人">{{store.storePersonName}}</el-descriptions-item>
        <el-descriptions-item label="备注">{{store.storeNotes}}</el-descriptions-item>
      </el-descriptions>
    </template>
    <template #footer>
      <el-button @click="storeDetailVisible = false">关闭</el-button>
    </template>
  </el-dialog>
</template>

<script setup>
import { ref, watch} from "vue";
import ledgerRequest from "@/api/ledger.js";
import maintainPlanRequest from "@/api/maintainPlan.js";
import toolsTypeRequest from "@/api/toolsType.js";
import toolsLedgerRequest from "@/api/toolsLedger.js";
import storeRequest from "@/api/store.js";
// 申明组件的属性
const props = defineProps(['storeId']);
// 弹窗标记
let storeDetailVisible = ref(false);
// 详情对象
let store = ref({})
// 通过id加载
function loadStore(){
  storeRequest.selectById(props.storeId,res=>{
    if(res.data){
      store.value = res.data;
      storeDetailVisible.value = true;
    }
  });
}
// 属性侦听
watch(()=>props.storeId,()=>{
  if(props.storeId){
    loadStore();
  }
});

</script>
<style scoped>

</style>